public class demo2 {
    public static void main(String[] args) {
        int j = 0;
        for (long i = 1;i<=10000;i++){
            String y = i +"";
            long x = i*i*i;
            String s = x + "";
            if (s.endsWith(y)){
                j++;
            }

        }
        System.out.println(j);
    }
}
